<template>
  <div>
    <a-table
      :columns="isPC ? columns : mobileColumns"
      :dataSource="data"
      @change="changePagination"
      :pagination="paginationInfo"
      rowKey="id"
      :scroll="isPC ? { x: false } : { x: 914 }"
    >
      <span slot="status" slot-scope="text">
        <span v-if="text === 1"
          ><i class="iconfont icondaishenhe"></i>待审核</span
        >
        <span v-else-if="text === 2"
          ><i class="iconfont icondaishenhe"></i>进行中</span
        >
        <span v-else-if="text === 3" class="text-green"
          ><i class="iconfont iconyitongguo"></i>成功</span
        >
        <span v-else class="text-red"
          ><i class="iconfont iconyijujue"></i>失败</span
        >
      </span>
    </a-table>
  </div>
</template>

<script>
import "@/assets/fonticon/iconfont.css";
export default {
  name: "hryTable",
  data() {
    return {
      form: this.$form.createForm(this),
      data: [],
      columns: [
        { title: "订单号", dataIndex: "order_num", align: "center" },
        {
          title: "提现金额（元）",
          dataIndex: "money"
        },
        {
          title: "手续费（元）",
          dataIndex: "fee"
        },
        {
          title: "实际到账金额（元）",
          dataIndex: "true_money"
        },
        { title: "到账银行账户", align: "center", dataIndex: "bank_num" },
        {
          title: "提现状态",
          width: 110,
          dataIndex: "status",
          scopedSlots: { customRender: "status" }
        },
        {
          title: "创建时间",
          dataIndex: "create_time",
          align: "center"
        }
      ],
      mobileColumns: [
        { title: "订单号", width: 100, dataIndex: "order_num", fixed: "left" },
        { title: "提现金额", width: 98, dataIndex: "money" },
        {
          title: "手续费",
          width: 98,
          dataIndex: "fee"
        },
        { title: "实际到账金额", width: 98, dataIndex: "true_money" },
        { title: "到账银行账户", width: 200, dataIndex: "bank_num" },
        {
          title: "提现状态",
          width: 110,
          dataIndex: "status",
          scopedSlots: { customRender: "status" }
        },
        { title: "创建时间", dataIndex: "create_time", width: 200 }
      ],
      paginationInfo: {
        total: 0,
        current: 1,
        pageSize: 10
      },
      project_name: ""
    };
  },
  methods: {
    changePagination(pagination) {
      Object.assign(this.paginationInfo, pagination);
      this.getList();
    },
    getList() {
      let obj = {
        pageNumber: this.paginationInfo.current,
        pageSize: this.paginationInfo.pageSize,
        type: 2
      };
      this.$ajax
        .post(this.$api.getWithdrawList, obj)
        .then(res => {
          this.paginationInfo.total = res.total;
          this.data = res.data;
        })
        .catch(err => {
          this.$message.error(err);
        });
    }
  },
  created() {
    this.getList();
  },
  computed: {
    isPC() {
      return this.$store.state.isPC;
    }
  }
};
</script>

<style scoped lang="less">
.iconfont {
  display: inline-block;
  margin-right: 5px;
}
</style>
